package pwd.allen.construct.bridge;

import pwd.allen.construct.common.MysqlConnection;
import pwd.allen.construct.common.OracleConnection;

/**
 *
 * @author lenovo
 * @create 2021-05-20 8:44
 **/
public class Main {
    public static void main(String[] args) {
        String host = "127.0.0.1";
        int port = 3333;
        String dbName = "test";
        AbstractionOrm orm = null;

        // 用户面向AbstractionOrm，无须了解底下用了什么orm框架和数据库组合
        // 如果使用继承的方式实现，如果3种orm+3种数据库要实现9个子类
        orm = new MybatisOrm(new MysqlConnection());
        orm.exec(host, port, dbName);

        orm = new HibernateOrm(new OracleConnection());
        orm.exec(host, port, dbName);
    }
}
